package com.iweb.tmall.swagger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class Swagger2Config {
    @Bean
    public Docket docket(){
        ApiInfo apiInfo = new ApiInfoBuilder().description("")
                .contact(new Contact("杰尼龟龟", "http://jieniguiugi.com", "jieniguigui@163.com"))
                .version("v1.0")
                .title("电商系统后台API文档")
                .license("Apache2.0")
                .licenseUrl("http://www.apache.org/license/LICENSE_2.0")
                .build();
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.iweb.tmall.controller"))
                .paths(PathSelectors.any())
                .build().apiInfo(apiInfo);
        return docket;
    }
}
